import type { PatientItem } from '@/types/patient'
import request from '@/utils/request'

/**
 * 获取患者（家庭档案）列表
 */
export const getPatientListAPI = () => {
  return request.get<null, PatientItem[]>('/patient/mylist')
}

/**
 * 新增患者
 */
export const addPatientAPI = (data: PatientItem) => {
  return request.post<null, PatientItem>('/patient/add', data)
}

/**
 * 删除患者
 */
export const deletePatientAPI = (id: string) => {
  return request.delete(`/patient/del/${id}`)
}

/**
 * 获取患者详情
 */
export const getPatientDetailAPI = (id: string) => {
  return request.get<null, PatientItem>(`/patient/info/${id}`)
}

/**
 * 编辑患者
 */
export const editPatientAPI = (data: PatientItem) => {
  return request.put(`/patient/update`, data)
}